package com.example.springboot.controller.encrypt;

import com.example.springboot.config.anotation.encrypt.EncryptField;
import com.example.springboot.config.anotation.encrypt.EncryptMethod;
import com.example.springboot.dao.UserRepository;
import com.example.springboot.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/8/4 14:45
 */
@RestController
@RequestMapping("/czk/encrypt")
public class EncryptorController {
    @Autowired
    private UserRepository userRepository;

    @EncryptMethod
    @PostMapping(value = "test")
    public Object testEncrypt(User user, @EncryptField String name) {
        System.out.println(name);
        user.setLastName(name);
        return userRepository.save(user);
    }
}
